package ro.upt.dcda.web;

import java.util.Map;

import ro.upt.dcda.pricezone.s1.pojo.User;

import com.opensymphony.xwork2.ActionContext;

public class ChangeLocation {

	private String location;
	private String longitude;
	private String latitude;

	public String execute() throws Exception {
		System.out.println("Changing location");
		Map<String, Object> session = ActionContext.getContext().getSession();
		User user = (User) session.get("user");
		String sid = (String) session.get("sid");
		if (user == null || sid == null) {
			return "noAuth";
		}
		session.put("city", location);
		session.put("longitude", longitude);
		session.put("latitude", latitude);
		session.put("location", location);
		return "def";
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}
}
